﻿CREATE TABLE [dbo].[DBOrderStatus] (
    [ID]         UNIQUEIDENTIFIER DEFAULT (newid()) NOT NULL,
    [Status]     VARCHAR (20)     NOT NULL,
    [StatusTime] DATETIME         NOT NULL,
    [OrderID]    UNIQUEIDENTIFIER NULL,
    PRIMARY KEY CLUSTERED ([ID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF),
    CHECK ([Status]='CORRECTION_REPORT' OR [Status]='OUT_REPORT' OR [Status]='PARTIALLY_FILLED' OR [Status]='FILLED' OR [Status]='REJECT_MODIFY' OR [Status]='ACK_MODIFY' OR [Status]='REJECT_CANCEL' OR [Status]='ACK_CANCEL' OR [Status]='REJECT' OR [Status]='ACK'),
    FOREIGN KEY ([OrderID]) REFERENCES [dbo].[DBOrder] ([ID]) ON DELETE CASCADE ON UPDATE NO ACTION
);

